package com.tjian.fafa.user.base;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.tjian.fafa.user.R;
import com.tjian.fafa.user.base.mainBody.MainBodyActivity;

import java.util.Timer;
import java.util.TimerTask;

public class regReturnPage extends Activity
{

    private Button recarindex;
    Timer timer = new Timer();//timer中有一个线程,这个线程不断执行task

    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.regscceedturn);


        TimerTask task = new TimerTask()   //timertask实现runnable接口,TimerTask类就代表一个在指定时间内执行的task
        {
            @Override
            public void run()
            {
                Intent intent1 = new Intent(regReturnPage.this, MainBodyActivity.class);
                startActivity(intent1);
                finish();
            }
        };
        // Schedule a task for single execution after a specified delay.
        timer.schedule(task, 1000 * 3);//设置这个task在延迟三秒之后自动执行


        recarindex = (Button) findViewById(R.id.re_carindex);
        recarindex.setOnClickListener(new OnClickListener()
        {
            @Override
            public void onClick(View v)
            {
                Intent intent0 = new Intent(regReturnPage.this, MainBodyActivity.class);
                startActivity(intent0);
                timer.cancel();
                finish();
            }
        });

    }
}
